package com.qianbao.controller.v1.coinrecord;

import com.qianbao.components.excepion.CommonException;
import com.qianbao.components.svresut.Result;
import com.qianbao.components.svversion.ApiVersion;
import com.qianbao.domain.coinrecord.CoinRecordEntity;
import com.qianbao.service.coinrecord.CoinRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;

@Controller
@ApiVersion(1)
@RequestMapping("/coinrecord/{version}/")
public class CoinRecordController {

    @Autowired
    private CoinRecordService service;


    @RequestMapping("/find-coin-record")
    @ResponseBody
    public Result findRecordList(@Valid CoinRecordEntity entity){
        try {
            List<CoinRecordEntity> recordList = service.findAllRecordList(entity);
            HashMap<String,List> map = new HashMap<>();
            map.put("list",recordList);
            return Result.success(map);
        } catch (CommonException e) {
            e.printStackTrace();
            return Result.fail(e.getCode(),e.getMessage());
        }
    }






}













